#ifndef IMGJOINTTRY_H
#define IMGJOINTTRY_H

#include <QObject>

#include <iostream>
#include <stdio.h>
#include "opencv2/core.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include"opencv2/flann.hpp"
#include <opencv2/xfeatures2d.hpp>
//#include "D:/opencv/sources/opencv_contrib-3.4.1/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp"
#include"opencv2/ml.hpp"


using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;
using namespace cv::ml;

typedef struct
{
    cv::Point2f left_top;
    cv::Point2f left_bottom;
    cv::Point2f right_top;
    cv::Point2f right_bottom;
}four_corners_t;

class ImgJointTry : public QObject
{
    Q_OBJECT
public:
    explicit ImgJointTry(QObject *parent = nullptr);

signals:

public slots:

public:
    cv::Mat image_left,image_right;
    four_corners_t corners;
    QString m_resultImageDir; // 目标图像目录
    vector<KeyPoint> mKeyRight, mKeyLeft;//图像特征的关键点集
    vector< DMatch > mGood_matches;//最近匹配特征点集

    void merg2Image(QString dstImageDir,QString leftImgPath,QString rightImgPath);
    void imageMelt();
    void CalcCorners(const cv::Mat& H, const cv::Mat& src);
    void OptimizeSeam(cv::Mat& img1, cv::Mat& trans, cv::Mat& dst);
};

#endif // IMGJOINTTRY_H
